// 跟視圖相關的一些全局數據

import { reactive } from 'vue'

type IState = { footerHeight: number; headerHeight: number }

function layoutStore() {
  const state = reactive({
    footerHeight: 0,
    headerHeight: 0,
  })

  const updateLayout = (patch: Partial<IState> = {}) => {
    state.headerHeight = patch.headerHeight ?? state.headerHeight
    state.footerHeight = patch.footerHeight ?? state.footerHeight
  }

  return { state, updateLayout }
}

export default layoutStore()
